﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using AdminApplication.PresentationLogic.Controllers;
using AssessmentTool.Services.DTO;
using System.Collections;

namespace AdminApplication.Controls
{
    public partial class ListUsers : UserControl
    {
        ListUsersController controller;
        
        public ListUsers()
        {
            InitializeComponent();
            controller = new ListUsersController(this);
        }

        public void userList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            IEnumerable<DTOUtente> utentiDTO = userList.SelectedItems.Cast<DTOUtente>();
           // DTOUtente utente = (DTOUtente)userList.SelectedItem;

            controller.selectUtente(utentiDTO);
        }

        public void inserisciButton_Click(object sender, RoutedEventArgs e)
        {
            controller.insertUtente();
        }


        public void importaButton_Click(object sender, RoutedEventArgs e)
        {
            controller.importUtente();
        }

        private void downloadTemplate(object sender, MouseButtonEventArgs e)
        {
            controller.downloadTemplate();
        }

               
    }
}
